package com.jiawa.train.business.req;

import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ConfirmOrderDoReq {

    /**
    * id
    */
    private Long id;

    /**
    * 会员id
    */
    private Long memberId;

    /**
    * 日期
    */
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
   @NotNull(message = "【日期】不能为空")
    private Date date;

    /**
    * 车次编号
    */
   @NotBlank(message = "【车次编号】不能为空")
    private String trainCode;

    /**
    * 出发站
    */
   @NotBlank(message = "【出发站】不能为空")
    private String start;

    /**
    * 到达站
    */
   @NotBlank(message = "【到达站】不能为空")
    private String end;

    /**
    * 余票ID
    */
   @NotNull(message = "【余票ID】不能为空")
    private Long dailyTrainTicketId;

    /**
    * 车票
    */
    @NotNull(message = "车票列表不能为空")
    @Size(min = 1, message = "至少需要一张车票")
    @Valid  // 确保列表中的每个对象也会被验证
    private List<ConfirmOrderTicketReq> tickets;

    @NotBlank(message = "【图片验证码】不能为空")
    private String imageCode;

    /**
     * 图片验证码token
     */
    @NotBlank(message = "【图片验证码】参数非法")
    private String imageCodeToken;
    /**
     * 订单状态
     */
    private String status;

    /**
    * 新增时间
    */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;

    /**
    * 修改时间
    */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date updateTime;


}